//
//  AboutViewController.m
//  绿地管理系统
//
//  Created by rimi on 16/1/18.
//  Copyright © 2016年 hexs. All rights reserved.
//

#import "AboutViewController.h"
#import "LoginViewController.h"

@interface AboutViewController ()

@property (nonatomic, strong) UIImageView   *imageView;
@property (nonatomic, strong) UIButton      *reflushButton;
@property (nonatomic, strong) UIButton      *exitButton;

@end

@implementation AboutViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"底_03"]];
    
    [self initializeAppearance];
}

- (void)initializeAppearance
{
    self.view.backgroundColor = [UIColor colorWithRed:240/255.0 green:240/255.0 blue:240/255.0 alpha:1.0];
    [self.view addSubview:self.imageView];
    [self.view addSubview:self.reflushButton];
    [self.view addSubview:self.exitButton];
}
#pragma mark -- Method
- (void)onReflushButton:(UIButton *)sender
{
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"已是最新版本" preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    [alertController addAction:sureAction];
    [self presentViewController:alertController animated:YES completion:nil];
}
- (void)onExitButton:(UIButton *)sender
{
    LoginViewController *loginVC = [[LoginViewController alloc] init];
    [self presentViewController:loginVC animated:YES completion:nil];
}

#pragma mark -- getter
- (UIImageView *)imageView
{
    if (_imageView == nil) {
        _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 330, 350)];
        _imageView.center = CGPointMake(CGRectGetMidX(self.view.bounds), 280);
        _imageView.image = [UIImage imageNamed:@"设置_02"];
    }
    return _imageView;
}

- (UIButton *)reflushButton
{
    if (_reflushButton == nil) {
        _reflushButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _reflushButton.frame = CGRectMake(0, 0, 330, 28);
        _reflushButton.center = CGPointMake(CGRectGetMidX(self.view.bounds), 490);
        [_reflushButton setImage:[UIImage imageNamed:@"检查更新_03"] forState:UIControlStateNormal];
        [_reflushButton addTarget:self action:@selector(onReflushButton:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _reflushButton;
}
- (UIButton *)exitButton
{
    if (_exitButton == nil) {
        _exitButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _exitButton.frame = CGRectMake(0, 0, 330, 28);
        _exitButton.center = CGPointMake(CGRectGetMidX(self.view.bounds), 535);
        [_exitButton setImage:[UIImage imageNamed:@"退出登录_03"] forState:UIControlStateNormal];
        [_exitButton addTarget:self action:@selector(onExitButton:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _exitButton;
}

@end










